// alert('1111');
// var num = 11;
// alert(num);

function mul(m){
	document.write('<table style="border-collapse:collapse;">');
	for (var i = m; i >= 1 ; i--) {
			document.write('<tr>');
		for (var j = 1; j <=i; j++) {
			var bg;
			// if(j%2 == 1){
			// 	bg = "#DFCF7B";
			// }
			// else{
			// 	bg = "#FF903C";
			// }
			var m = i-j;
			switch(m){
				case 8 : bg = '#FFFFFF';break;
				case 7 : bg = '#F0F0F0';break;
				case 6 : bg = '#E1E1E1';break;
				case 5 : bg = '#D1D1D1';break;
				case 4 : bg = '#C3C3C3';break;
				case 3 : bg = '#B3B3B3';break;
				case 2 : bg = '#AAAAAA';break;
				case 1 : bg = '#9C9C9C';break;
				case 0 : bg = '#8C8C8C';break;
				default:;
			}
			
			document.write('<td style="background-color:'+bg+';">');
			document.write(i +'*'+ j + '=' + i*j );
			document.write('</td>');

		};
		document.write('</tr>')
	};

	document.write('</table>');
}

function mull(m){
	document.write('<table style="border-collapse:collapse;">');
	for (var i = m; i >= 1 ; i--) {
			document.write('<tr>');
		for (var j = 1; j <=i; j++) {
			var bg;
			if(j%2 == 1){
				bg = "#DFCF7B";
			}
			else{
				if(i%2 == 1){
					bg = '#FF903C';
				}else{
					bg = '#138AC5';
				}
			}

			document.write('<td style="background-color:'+bg+';">');
			document.write(i +'*'+ j + '=' + i*j );
			document.write('</td>');

		};
		document.write('</tr>')
	};

	document.write('</table>');
}
function mulll(m){
	document.write('<table style="border-collapse:collapse;">');
	for (var i = m; i >= 1 ; i--) {
			document.write('<tr>');
		for (var j = 1; j <=i; j++) {
			var bg;
			// if(j%2 == 1){
			// 	bg = "#DFCF7B";
			// }
			// else{
			// 	bg = "#FF903C";
			// }
			var m = i-j;
			switch(m){
				case 8 : bg = '#FFFFFF';break;
				case 7 : bg = '#FFFFF0';break;
				case 6 : bg = '#FFFFE1';break;
				case 5 : bg = '#FFFFD2';break;
				case 4 : bg = '#FFFFC3';break;
				case 3 : bg = '#FFFFB4';break;
				case 2 : bg = '#FFFFA1';break;
				case 1 : bg = '#FFFF96';break;
				case 0 : bg = '#FFFF87';break;
				default:;
			}
			
			document.write('<td style="background-color:'+bg+';">');
			document.write(i +'*'+ j + '=' + i*j );
			document.write('</td>');

		};
		document.write('</tr>')
	};

	document.write('</table>');
}
mull(9);

mul(9);

mulll(9);